package com.yjd.bi.system.service.impl;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;

import com.yjd.comm.base.dao.IBaseDao;
import com.yjd.comm.base.service.impl.BaseServiceImpl;
import com.yjd.bi.system.model.TimeDimensionModel;
import com.yjd.bi.system.service.ITimeDimensionService;
import com.yjd.bi.system.dao.ITimeDimensionDao;

/**
 * <b>description</b>：资金量记录业务实现<br>
 * <b>time</b>：2016-04-14 16:48:42 <br>
 * <b>author</b>：  chenpengfei@yijeidai.com
 */
@Service("timeDimensionService")
public class TimeDimensionServiceImpl extends BaseServiceImpl implements ITimeDimensionService {

	/**
	 * 插入
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public TimeDimensionModel insert(TimeDimensionModel model) throws Exception {
		return this.timeDimensionDao.insertModel(model, true);
	}

	/**
	 * 更新
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public int update(TimeDimensionModel model) throws Exception {
		return this.timeDimensionDao.updateModel(model, true);
	}

	/**
	 * 根据id删除
	 * 
	 * @param date
	 * @return
	 * @throws Exception
	 */
	public int delete(long date) throws Exception {
		Map<Object, Object> paramMap = new HashMap<Object, Object>();
		paramMap.put("date", date);
		return this.timeDimensionDao.deleteModel(paramMap, true);
	}

	@Resource
	private ITimeDimensionDao timeDimensionDao;

	@Override
	public IBaseDao getBaseDao() {
		return this.timeDimensionDao;
	}

}
